function selectOption(value) {
    const radios = document.getElementsByName('options');
    for (let i = 0; i < radios.length; i++) {
        if (radios[i].value === value) {
            radios[i].checked = true;
        } else {
            radios[i].checked = false;
        }
    }
}
function clickListener() {
    document.querySelectorAll('input[name="options"]').forEach(radio => {
        radio.addEventListener('change', function (event) {
            if (event.target.checked) {
                chrome.storage.sync.set({ type: event.target.value });
            }
        });
    });
}
function init() {
    chrome.storage.sync.get("type", ({ type }) => {
        selectOption(type);
        clickListener();
    });
}
init();